var e = require;
var t = module;
var o = exports;
var n;
Object.defineProperty(o, "__esModule", {value: !0}), (o.PrivacyType = void 0);
var r = e("SDK"),
    s = e("AdUtils"),
    c = e("EncryptUtil"),
    l = cc._decorator,
    d = l.ccclass;
l.property,
    (function (e) {
        (e[(e.LINGQU = 0)] = "LINGQU"), (e[(e.ANPAI = 1)] = "ANPAI");
    })(o.PrivacyType || (o.PrivacyType = {}));
var u = (function (e) {
    function t() {
        var t = (null !== e && e.apply(this, arguments)) || this;
        return (
            (t.companys = ["深圳灵趣科技有限公司", "湖南安派信息技术有限公司"]),
            (t.email = ["2169346100@qq.com", "1704924193@qq.com"]),
            (t._privacyNode = null),
            (t.colors = [
                cc.color(182, 178, 184),
                cc.color(244, 247, 89),
                cc.color(74, 155, 255),
                cc.color(89, 247, 92),
                cc.color(181, 89, 247)
            ]),
            (t.showBannerAfterClose = !0),
            t
        );
    }
    return (
        __extends(t, e),
        (t.prototype.showPrivacy = function (e, t) {
            var o = this,
                n = this;
            if (((n.showBannerAfterClose = t), !(cc.sys.localStorage.getItem("privacy", 0) > 0))) {
                var i = "sdk/res/prefabs/Privacy";
                r.default.Instance.edType,
                    r.default.Instance.edType == c.EncryptType.ED_CY && (i = "sdk/res/prefabs/PrivacyCY"),
                    s.default.instance.loadPrefabs(i, function (t) {
                        (o._privacyNode = cc.instantiate(t)), s.default.instance.log("创建Privacy");
                        var i = cc.director.getScene().getChildByName("Canvas"),
                            a = o._privacyNode.getChildByName("agree");
                        a.on(cc.Node.EventType.TOUCH_START, o.close, o),
                            o._privacyNode.getChildByName("refused").on(cc.Node.EventType.TOUCH_START, o.closeGame, o),
                            a.getChildByName("Background");
                        var c = s.default.instance.getRandomInt(0, 4);
                        console.log("颜色： " + c),
                            (o._privacyNode
                                .getChildByName("content")
                                .getChildByName("view")
                                .getChildByName("content")
                                .getChildByName("mail")
                                .getComponent(cc.Label).string = o.companys[e] + "\n" + o.email[e]),
                            r.default.Instance.showGameCollection()
                                ? i.addChild(o._privacyNode, 999, "Privacy")
                                : cc.resources.load("sdk/config/gameConfig", cc.JsonAsset, function (e, t) {
                                      if (e) console.error("Failed to load JSON:", e);
                                      else {
                                          var a = t.json;
                                          (n._privacyNode.group = a[0].boxGroup),
                                              i.addChild(o._privacyNode, 999, "Privacy");
                                      }
                                  });
                    });
            }
        }),
        (t.prototype.closeGame = function () {
            cc.director.end(), r.default.Instance.closeGame();
        }),
        (t.prototype.close = function () {
            this._privacyNode &&
                (cc.sys.localStorage.setItem("privacy", 1),
                this._privacyNode.removeFromParent(),
                this._privacyNode.destroy(),
                (this._privacyNode = null),
                !r.default.Instance.isPortrait() && this.showBannerAfterClose && r.default.Instance.showBanner());
        }),
        __decorate([d], t)
    );
})(cc.Component);
o.default = u;
